Component({
  data: {
    selected: 0,
    color: "#7A7E83",
    selectedColor: "#ff0000",
    list: [
      {
        pagePath: "/pages/index/index",
        iconPath: "/images/shouye.png",
        selectedIconPath: "/images/shouye-sel.png",
        text: "首页",
      },
      {
        pagePath: "/pages/category/index",
        iconPath: "/images/fenlei.png",
        selectedIconPath: "/images/fenlei-sel.png",
        text: "分类",
      },
      {
        pagePath: "/pages/brand/index",
        iconPath: "/images/pinpai.png",
        selectedIconPath: "/images/pinpai-sel.png",
        text: "品牌",
      },
      {
        pagePath: "/pages/cart/index",
        iconPath: "/images/daizi.png",
        selectedIconPath: "/images/daizi-sel.png",
        text: "购物袋",
      },
      {
        pagePath: "/pages/self/index",
        iconPath: "/images/wode.png",
        selectedIconPath: "/images/wode-sel.png",
        text: "我的",
      },
    ],
  },
  attached() {},
  methods: {
    switchTab(e) {
      const data = e.currentTarget.dataset;
      const url = data.path;
      wx.switchTab({ url });
      this.setData({
        selected: data.index,
      });
    },
  },
});
